import 'package:FlutterDemo/bean/beans_factory.dart';
import 'package:FlutterDemo/bean/datas.dart';
import 'package:FlutterDemo/common/page_basic_list.dart';
import 'package:flutter/material.dart';

/// ListPage 类型
enum ListPageTarget {
  PAGEMAINAPPSTATEWIDGET,
  PAGEROSAPPWIDGET,
  PAGELISTVIEWWIDGET,
  PAGESCROLLBARSWIDGET,
  PAGERSLIVERVIEWSAPPWIDGET,
  PAGERSCROLLVIEWSAPPWIDGET,
  PRACTICALEXTENSIONAPPWIDGET,
  PAGEAPPSTATEMANAGERSWIDGET,
  PAGEPROVIDERLISTWIDGET,
  PAGEBLOCLISTWIDGET,
  PAGEBLOCPRACTICALWIDGET,
  PAGEPLUGINLIST,
  PAGEANDROIDFLUTTERCOMMUNCATION,
  LOCATIONWRAPPERWIDGETLIST, // 定位装饰权重组件
  FLUTTERBLOC, // FlutterBloc
  GETX, // GetX
  RXDART, // RXDART
}

/// 简易List列表提供者
/// 简单列表提供者
class SampleListPageProvider {
  static final SampleListPageProvider _pageProvider = SampleListPageProvider.internal();

  // 工厂方法
  factory SampleListPageProvider() => _pageProvider;

  SampleListPageProvider.internal();

  /// 构建ListPage
  Widget buildListPageWidget(ListPageTarget target) {
    List<PageInfo> dataList = [];
    switch (target) {
      case ListPageTarget.PAGEMAINAPPSTATEWIDGET:
        dataList = BeansFactory.instance.buildMainPagerList();
        break;
      case ListPageTarget.PAGEROSAPPWIDGET:
        dataList = BeansFactory.instance.buildCustomerViewPageMainList();
        break;
      case ListPageTarget.PAGELISTVIEWWIDGET:
        dataList = BeansFactory.instance.buildSampleSubList();
        break;
      case ListPageTarget.PAGESCROLLBARSWIDGET:
        dataList = BeansFactory.instance.buildSampleScrollbarsList();
        break;
      case ListPageTarget.PAGERSLIVERVIEWSAPPWIDGET:
        dataList = BeansFactory.instance.buildSampleSlivers();
        break;
      case ListPageTarget.PAGERSCROLLVIEWSAPPWIDGET:
        dataList = BeansFactory.instance.buildScrollPageDatas();
        break;
      case ListPageTarget.PRACTICALEXTENSIONAPPWIDGET:
        dataList = BeansFactory.instance.buildSamplePracticalExtensionList();
        break;
      case ListPageTarget.PAGEAPPSTATEMANAGERSWIDGET:
        dataList = BeansFactory.instance.buildSampleStateManagersList();
        break;
      case ListPageTarget.PAGEPROVIDERLISTWIDGET:
        dataList = BeansFactory.instance.buildSampleProviders();
        break;
      case ListPageTarget.PAGEBLOCLISTWIDGET:
        dataList = BeansFactory.instance.buildSampleBlocs();
        break;
      case ListPageTarget.PAGEBLOCPRACTICALWIDGET:
        dataList = BeansFactory.instance.buildBlocPracticalList();
        break;
      case ListPageTarget.PAGEPLUGINLIST:
        dataList = BeansFactory.instance.buildPluginPracticalList();
        break;
      case ListPageTarget.PAGEANDROIDFLUTTERCOMMUNCATION:
        dataList = BeansFactory.instance.buildCommuncList();
        break;
      case ListPageTarget.LOCATIONWRAPPERWIDGETLIST:
        dataList = BeansFactory.instance.builLocationWrapperWidgetList();
        break;
      case ListPageTarget.FLUTTERBLOC:
        dataList = BeansFactory.instance.builFlutterBlocWidgetList();
        break;
      case ListPageTarget.GETX:
        dataList = BeansFactory.instance.builGetXList();
        break;
      case ListPageTarget.RXDART:
        dataList = BeansFactory.instance.builRxDartList();
        break;
      default:
        break;
    }
    return BasicLoadingListWidget(dataList);
  }
}
